function verify(){  
   var mydata = '{"queryParams":"' + $("#readerName").val() + '"}';
   $.ajax({                   
	   type:'post',                   
	   url:'/bms/borrowreturninfo/verifyReader',//URL                 
	   data:mydata,                
	   dataType:'json',
	   contentType : "application/json; charset=utf8",
	   success:function(data) { 
		    // debugger;
		  
		      var brdata=data.borrowreturnInfo;
		      var borrowedAmount=data.borrowedAmount;
		      var readerInfo=data.readerInfo;
		      var verReader=data.verReader;
		      if(readerInfo!=null){
		    	  $("#verify").html("<font color='green'>"+verReader+"</font>");
		    	  var canBorrowAmount=readerInfo.roleId.brwAmtLimit-borrowedAmount;
		    	  if(canBorrowAmount<=0){
			    	  //$("#btn").attr("class","btn red");
		    		  $("#btn").hide();
			    	  $("#message").html("<font color='red'>This role has reached maximum borrow amount<font>");
			    	  $("#btn").attr("disabled", true);	
			      }else{
			    	  $("#btn").show();
			    	  $("#btn").attr("class","btn blue");
			    	  $("#btn").attr("disabled", false);
			    	  $("#message").html("<font color='green'>This role can broow "+canBorrowAmount+"  books <font>");
			      }			    
		      }else{
		    	  $("#verify").html("<font color='red'>"+verReader+"</font>");
		    	  //$("#btn").attr("class","btn red");
		    	  $("#btn").hide();
		    	  $("#btn").attr("disabled", true);
		      }    		    		    		    
		 	 createShowingTable(brdata);   
		    }
	   });
  }

function createShowingTable(data) {
	var tStrStart = "<div class='table-responsive'><table class='table table-bordered table-hover'><thead><tr><th>" + "No" + "</th>" + "<th>" +"Book Name" + "</th>" + "<th>" +"Borrowed Date"+"</th>"
				+"</tr></thead><tbody>";
	$.each(data, function(n, borrowreturnInfo) {
		//debugger;
			var brString="<tr><td>"+borrowreturnInfo.id+"</td><td>"+borrowreturnInfo.bookInfo.name+"</td><td>"+borrowreturnInfo.borrowedDate+"</td>" +"</tr>";			
		tStrStart = tStrStart + brString;      
	});
	var tStrEnd="</tbody></table></div>";
	tStrStart=tStrStart+tStrEnd;
	$("#br").html(tStrStart);
}

   

 
